package com.candy.candyorder.controller;

import com.candy.candycommon.utils.ResultBean;
import com.candy.candyorder.service.OrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * @author suYanLong
 * @date 2022年09月29日 13:36
 */
@Slf4j
@RestController
@RequestMapping("order")
public class OrderController {

    @Autowired
    OrderService orderService;

    @GetMapping("getByOrderId")
    public ResultBean getByOrderId(@RequestParam Long orderId) {
        if (orderId == null) {
            return ResultBean.error("订单id不能为空！");
        }
        log.info("=============getByOrderId============");
        if (orderId.equals(1l)) {
            return ResultBean.ok("1111");
        }
        return ResultBean.ok("other orderId");
    }

    @PostMapping("saveBatch")
    public ResultBean saveBatch() {
        orderService.insertBatchList();
        return ResultBean.ok("other orderId");
    }

}
